package com.sikaryofficial.common.core.constant;

import java.util.Arrays;

/**
 * @author : qinjinyuan
 * @desc : 活动类型枚举
 * @date : 2023/11/04 10:08
 */
public enum ChannelEnum {

    /**
     * 移动端业务标识
     */
    MOBILE("mobile", "移动端业务标识"),
    /**
     * pc端业务标识
     */
    PC("pc", "pc端业务标识"),
    ;
    private final String code;
    private final String name;

    ChannelEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static ChannelEnum getNameByCode(String code) {
        return Arrays.stream(ChannelEnum.values())
                .filter(channelEnum -> channelEnum.getCode().equals(code))
                .findFirst().orElse(null);
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
